//
//  Some ship in 3D
//

object ship
  extends body, moving_body, spinning_body

  attrs
    float   max_speed
    float   max_spin
  end

  procs
    def spin_left
      ins
        float   spin
      end

      if spin > .max_spin then spin := .max_spin

      .yaw_velocity   +=  spin
    end

    def move_forward
      ins
        float   speed
      end

      if speed > .max_speed then speed := .max_speed
      
      f_x_velocity    :=  0.0
      f_y_velocity    :=  0.0
      f_z_velocity    :=  -speed

      //
      //  insert fancy math to rotate f_*_velocity by pitch, yaw, and roll
      //

      x_velocity      +=  f_x_velocity
      y_velocity      +=  f_y_velocity
      z_velocity      +=  f_z_velocity
    end

    def move
      ins
        seconds
      end

      moving_body::move( seconds )
      spin( seconds )
    end
  end
end


